package co.edu.unal.franquicias.mastercard.auth;

import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;

/**
 * Exception that can be thrown by the resources and gets mapped to a response status code.
 */
public class RequestProcessingException extends RuntimeException {
    private final Response.Status status;
    private final UriInfo uriInfo;

    /**
     * Creates a new instance.
     *
     * @param status status this exception should be mapped to
     * @param uriInfo {@link UriInfo} for the request this exception responds to
     */
    public RequestProcessingException(Response.Status status, UriInfo uriInfo) {
        this.status = status;
        this.uriInfo = uriInfo;
    }

    /**
     * Response status this exception will get mapped to.
     *
     * @return response status
     */
    public Response.Status getStatus() {
        return status;
    }

    /**
     * Corresponding request {@link UriInfo}.
     *
     * @return URI info
     */
    public UriInfo getUriInfo() {
        return uriInfo;
    }
}
